package com.guochenglang.www.dao.impl;

import com.guochenglang.www.dao.FilesDao;
import com.guochenglang.www.pojo.Files;
import com.guochenglang.www.util.GetTable;
import com.guochenglang.www.util.connect.JdbcUtil;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * 附件表的Dao层
 *
 * @author GuoChenglang
 */
public class FilesDaoImpl implements FilesDao {
    /**
     * 表名
     */
    private static final String TABLE = GetTable.getTable(Files.class);

    public FilesDaoImpl() {
    }


    @Override
    public ArrayList<Files> filesSelect(Files files) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.selectMax(TABLE, files);
    }

    @Override
    public ArrayList<Files> filesSelectByLimit(int page, int num, Files files, String order, String mode) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.selectByLimit(TABLE, page, num, files, order, mode);
    }


    @Override
    public int insertFiles(Files files) throws SQLException, InterruptedException, IllegalAccessException {
        return JdbcUtil.insert(TABLE, files);
    }

    @Override
    public int updateFiles(Files set, Files conditions) throws SQLException, InterruptedException, IllegalAccessException {
        return JdbcUtil.update(TABLE, set, conditions);
    }

    @Override
    public int deleteFiles(Files files) throws SQLException, InterruptedException, IllegalAccessException {
        return JdbcUtil.delete(TABLE, files);
    }
}
